<?php
/**
* Creater : phuongtt
* Date: 5/1/2011
* Idea: Lay danh sach quyen thuoc nhom
*/

class listxml_modPermissionInsuranceUnit extends Efy_DB_Connection {
	
	/**
	 * Creater : HUNGVM
	 * Date : 18/09/2009
	 *
	 * @param $scode : Ma nhom quyen
	 * @param $sTagName : Ten then luu nhom quyen
	 * @return Mang luu thong tin nhom quyen
	 */
	public function PermissionGroupGetAll($scode, $sTagName){		
		$sql = "EfyLib_PermissionGroupGetAll";
		$sql = $sql . "'" . $scode . "'";
		$sql = $sql . ",'" . $sTagName . "'";		
		//echo $sql; 
		try{
			$arrResult = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}
		return $arrResult;
	}

		/**
	 * Creater : HUNGVM
	 * Date : 21/09/2009
	 *
	 * @param $sStaffIdList : Danh sach NSD
	 * @return Mang luu thong tin quyen cua $sStaffIdList
	 */
	public function StaffPermissionGetAll($sStaffIdList, $sDelimitor = "!~~!"){		
		$sql = "EfyLib_StaffPermissionGetAll ";
		$sql = $sql . "'" . $sStaffIdList . "'";				
		$sql = $sql . ",'" . $sDelimitor . "'";				
		//echo $sql; 
		try{
			$arrResult = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}
		return $arrResult;
	}
	
	/**
	 * Creater : HUNGVM
	 * Date : 21/09/2009
	 * Idea : Tao phuong thuc update quyen cho NSD
	 *
	 * @param $arrParameter : Mang luu thong tin cac tham so can update
	 * @return RET_ERROR : <>'' Neu loi xay ra; = '' Not Error
	 */
	public function UnitInsuranceStaffPermissionUpdate($arrParameter){
		$psSql = "Exec [EfyLib_UnitInsuranceStaffPermissionUpdate] ";			
		$psSql .= "'" . $arrParameter['FK_STAFF_ID_LIST'] . "'";
		$psSql .= ",'" . $arrParameter['FK_PERMISSION_ID_LIST'] . "'";	
		$psSql .= ",'" . $arrParameter['C_DISTRICT_CODE_LIST'] . "'";		
		$psSql .= ",'" . $arrParameter['CONST_LIST_DELIMITOR'] . "'";
		$psSql .= ",'" . $arrParameter['C_HANDLE_STATUS'] . "'";	
		//Thuc thi lenh SQL		
		//echo htmlspecialchars($psSql); exit;
		try {			
			$arrTempResult = $this->adodbExecSqlString($psSql) ; 
			$Result = $arrTempResult['RET_ERROR'];
		}catch (Exception $e){
			echo $e->getMessage();
		};
		//Return result
		return $Result;		
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sStatus
	 * @param unknown_type $sPkUnitId
	 * @param unknown_type $sFullTextSearch
	 * @param unknown_type $sOwnerCode
	 */
	public function USERStaffGetAll ($sStatus,$sPkUnitId,$sFullTextSearch,$sOwnerCode){
		$dblinkUser = Efy_Init_Config::_setDbLinkUser();
		$psSql = "Exec $dblinkUser .dbo.USER_StaffGetAll ";
		$psSql .= "'"  . $sStatus . "'";
		$psSql .= ",'"  . $sPkUnitId . "'";
		$psSql .= ",'"  . $sFullTextSearch . "'";
		$psSql .= ",'"  . $sOwnerCode . "'";
		//echo  "<br>". $psSql . "<br>"; 
		//exit;
		try{
			$arrResult = $this->adodbQueryDataInNameMode($psSql);//Thuc thi chuoi sql va tra ra mang da chieu
		}catch (Exception $e){
			echo $e->getMessage();
		};
		return $arrResult;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sOwnerCode
	 * @param unknown_type $sCode
	 */
	public function OwnerCodeFromUserGetAll ($sOwnerCode, $sCode){
		$dblinkUser = Efy_Init_Config::_setDbLinkUser(); 
		$sql = "Exec $dblinkUser .dbo.EfyLib_ListGetAllbyListtypeCode ";
		$sql = $sql . " '" . $sOwnerCode . "'";
		$sql = $sql . " ,'" . $sCode . "'";
		//echo $sql . '<br>';//exit;
		try {
			$arrObject = $this->adodbQueryDataInNameMode($sql,$optCache);
		}catch (Exception $e){
			echo $e->getMessage();
		}
		return $arrObject;
	}
	/**
	 * 
	 * Enter description here ...
	 */
	public function UnitInsuranceGetAllForGenerateXmlData(){
		$dblinkUser = Efy_Init_Config::_setDbLinkUser(); 
		//echo $dblinkUser;
		$sql = "Exec [EfyLib_UnitInsuranceGetAllForGenerateXmlData] ";
		$sql .= "'"  . $dblinkUser . "'";
		//echo $sql . '<br>';//exit;
		try {
			$arrObject = $this->adodbQueryDataInNameMode($sql,$optCache);
		}catch (Exception $e){
			echo $e->getMessage();
		}
		return $arrObject;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sStatus
	 * @param unknown_type $sFullTextSearch
	 * @param unknown_type $sOwnercode
	 */
	public function USERUnitGetAll($sStatus,$sFullTextSearch,$sOwnercode){
		$dblinkUser = Efy_Init_Config::_setDbLinkUser();
		$psSql = "Exec $dblinkUser .dbo.USER_UnitGetAll ";
		$psSql .= "'"  . $sStatus . "'";
		$psSql .= ",'"  . $sFullTextSearch . "'";
		$psSql .= ",'"  . $sOwnercode . "'";
		//echo  "<br>". $psSql . "<br>"; 
		//exit;
		try {			
			$arrResult = $this->adodbQueryDataInNameMode($psSql);
		}catch (Exception $e){
			echo $e->getMessage();
		};				
		return $arrResult;
	}
	/**
	 * Creater:HUNGVM
	 * Date:16/12/2011
	 * Idea:Tạo phương thức hiển thị thông tin cán bộ đã được ban quyền	 
	 * @param 	$sDBLink: Tên DBlink server
	 * @param   $sUnitId Id phòng ban
	 * @param 	$sStatus: Trạng thái hoạt động của cán bộ
	 * @param 	$sFullTextSearch: Chuỗi tìm kiếm
	 * @param 	$sOwnerCode: Mã đơn vị sử dụng phần mềm
	 */
	public function USERUnitInsuranceStaffPermissionGetAll($sDBLink,$sUnitId,$sStatus,$sFullTextSearch,$sOwnerCode){		
		$psSql = "Exec [EfyLib_UnitInsuranceStaffPermissionGetAll] ";
		$psSql .= "'"  . $sDBLink . "'";
		$psSql .= ",'"  . $sUnitId . "'";
		$psSql .= ",'"  . $sStatus . "'";
		$psSql .= ",'"  . $sFullTextSearch . "'";
		$psSql .= ",'"  . $sOwnerCode . "'";
		//echo  "<br>". $psSql . "<br>"; 
		//exit;
		try{
			$arrResult = $this->adodbQueryDataInNameMode($psSql);//Thuc thi chuoi sql va tra ra mang da chieu
		}catch (Exception $e){
			echo $e->getMessage();
		};
		return $arrResult;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sStaffIdList
	 * @param unknown_type $sDelimitor
	 */
	public function USERUnitInsuranceInDatabaseGetAll($sStaffIdList,$sDelimitor){		
		$psSql = "Exec [EfyLib_UnitInsuranceGetAll] ";
		$psSql .= "'"  . $sStaffIdList . "'";
		$psSql .= ",'"  . $sDelimitor . "'";		
		//echo  "<br>". $psSql . "<br>"; //exit;
		try{
			$arrResult = $this->adodbQueryDataInNameMode($psSql);//Thuc thi chuoi sql va tra ra mang da chieu
		}catch (Exception $e){
			echo $e->getMessage();
		};
		return $arrResult;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sStaffIdList
	 * @param unknown_type $sDelimitor
	 */	
	public function USERPermissiondDistrictGetAll($sStaffIdList,$sDelimitor){		
		$psSql = "Exec [EfyLib_PermissiondDistrictGetAll] ";
		$psSql .= "'"  . $sStaffIdList . "'";
		$psSql .= ",'"  . $sDelimitor . "'";		
		//echo  "<br>". $psSql . "<br>"; //exit;
		try{
			$arrResult = $this->adodbQueryDataInNameMode($psSql);//Thuc thi chuoi sql va tra ra mang da chieu
		}catch (Exception $e){
			echo $e->getMessage();
		};
		return $arrResult;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sStatus
	 * @param unknown_type $sFullTextSearch
	 * @param unknown_type $sOwnerCode
	 * @param unknown_type $sUnitId
	 */
	public function USERStaffGetAllBySearch ($sStatus,$sFullTextSearch,$sOwnerCode,$sUnitId){
		$dblinkUser = Efy_Init_Config::_setDbLinkUser();
		$psSql = "Exec $dblinkUser .dbo.USER_StaffGetAllBySearch ";
		$psSql .= "'"  . $sStatus . "'";
		$psSql .= ",'"  . $sFullTextSearch . "'";
		$psSql .= ",'"  . $sOwnerCode . "'";
		$psSql .= ",'"  . $sUnitId . "'";
		//echo  "<br>". $psSql . "<br>"; 
		//exit;
		try{
			$arrResult = $this->adodbQueryDataInNameMode($psSql);//Thuc thi chuoi sql va tra ra mang da chieu
		}catch (Exception $e){
			echo $e->getMessage();
		};
		return $arrResult;
	}
}
?>